package com.ysxsoft.wdg.adapter.home;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ysxsoft.wdg.R;
import com.ysxsoft.wdg.bean.zy.GoodsBean;
import com.ysxsoft.wdg.util.ViewUtils;

public class ZyGoodsAdapter extends BaseQuickAdapter<GoodsBean,BaseViewHolder> {


    public ZyGoodsAdapter(int layoutResId) {
        super(layoutResId);
    }

    public void clear(){
        getData().clear();
        notifyDataSetChanged();
    }


    @Override
    protected void convert(BaseViewHolder helper, GoodsBean item) {

        helper.setText(R.id.tv_name,item.getName());

        TextView tvOldPrice = helper.getView(R.id.tv_old_money2);
        ViewUtils.setDeletLine(tvOldPrice);
        tvOldPrice.setText(mContext.getString(R.string.price_rmb,item.getPrice()));

        helper.setText(R.id.tv_money,mContext.getString(R.string.price_rmb,item.getL_price()));
        helper.setText(R.id.tv_quan,item.getHui()+"元优惠");
        helper.setText(R.id.tv_sold,"已售"+item.getSold());
        Glide.with(mContext).load(item.getPic()).into((ImageView) helper.getView(R.id.iv_pic));
    }
}
